let online = false,
domain;

if (online) {

    // domain = 'https://www.digitwonder.com'; //线上

} else {
    // domain = 'https://www.digitwonder.com'; //线上
    domain = 'https://api.digitwonder.com'; //线上测试
    // domain = 'http://192.168.164.163:8080';//内网
}
const api = {
    sogou: domain + '/biz/auth/squid',//搜狗图片
    login: domain + '/biz/auth/wechat/mini_prog', //微信登陆授权
    choose: domain + '/biz/channels', //选择领域
    selected: domain + '/biz/user/',//我选择
    minsList: domain + '/biz/subscribe_records', //首页文章列表
    details: domain + '/biz/essay/', //文章详情
    articleComments : domain+ '/biz/essay/',//获取文章评论列表
    collects: domain + '/biz/essay/', //文章收藏
    cancelcollect: domain +'/biz/essay/',//文章取消收藏
    amountEssay: domain + '/biz/match/',//文章匹配主题列表
    followTheme: domain + '/wechat/consulting/theme/focusOnTheme', //关注主题
    articleGood: domain + '/biz/essay/', //文章点赞
    cancelGood: domain+ '/biz/essay/',//文章取消点赞
    writecomment: domain + '/biz/essay/', //文章评论
    commentGoods: domain + '/biz/comment/', // 评论点赞 
    replyReply: domain + '/wechat/consulting/article/reply', // 回复 回复
    moreComment: domain + '/biz/essay/', //获取更多评论
    replyComment: domain + '/wechat/consulting/article/reply', //回复评论
    themeHome: domain + '/biz/topic/', //主题主页 主题详情接口
    themeessays: domain + '/biz/topic/',//主题文章列表
    FollowThemeList: domain + '/biz/topic/',//订阅主题的用户列表
    MessageQuery: domain + '/biz/topic/', //首页主题留言查询
    message: domain + '/biz/topic/', //留言查询 
    delMessage: domain +'/biz/user/',//删除我的主题留言
    themeMessage: domain + '/biz/topic/', //主题留言评论
    replyMes: domain + '/biz/topic/', //留言回复
    GoodTheme: domain + '/biz/comment/', //主题留言点赞
    myMessage: domain +'/biz/user/',//我的留言列表 
    claimTheme: domain + '/wechat/consulting/theme/claimTheme', // 认领主题 
    amountFollow:domain + '/wechat/consulting/article/viewFocusUsers', //查看关注主题用户列表
    reviewDetails: domain + '/biz/review/',//解读详情列表
    writereview: domain + '/biz/essay/',//写解读
    reviewList: domain + '/biz/essay/',//解读列表
    reviewCommentList: domain + '/biz/review/',//获取解读下面得评论
    reviewGood: domain + '/biz/review/',//解读点赞
    reviewGoodNo: domain + '/biz/review/',//取消解读点赞
    reviewcollect: domain + '/biz/review/',//解读收藏
    reviewComment: domain + '/biz/review/',//解读下面得写评论


    
    getComment: domain + '/biz/user/', // 回复
    delreply: domain + '/wechat/consulting/personal/delReply', // 删除个人回复
    mycollect: domain + '/biz/user/', //个人中心 我的收藏
    cancelCollect: domain + '/biz/essay/', // 取消收藏
    myfollow: domain + '/biz/user/', //个人中心 我的订阅
    Mytheme: domain + '/biz/user/', // 我的主题列表
    reviewList: domain +'/biz/user/',//我的解读列表
    preEditTheme: domain + '/wechat/consulting/personal/preEditTheme', //主题预修改接口 
    EditorTheme: domain + '/biz/topic/', // 编辑个人主题 
    delMytheme: domain + '/biz/user/', //删除个人主题
    objection: domain + '/biz/feedbacks', // 个人中心 意见反馈
    isiphone: domain + '/biz/auth/mobile/verify', //验证手机号码是否可用
    sendCode: domain + '/biz/auth/captcha', //发送验证码
    yzCode: domain + '/biz/user/', //绑定手机号
    userInfo:domain + '/biz/user/',//获取用户详情
    auditMsgList: domain + '/biz/user/',//用户主题未审核留言列表
    checkMsg: domain + '/biz/comment/', //留言审核
    getMessageAudit: domain + '/biz/user/',//获取留言待审核得列表
    informCount: domain + '/biz/user/',//获取未读通知数量
    xitonginform: domain + '/biz/user/',//用户系统通知
    informComment: domain + '/biz/user/',//用户系统通知
    commentno: domain + '/biz/user/', //个人中心 获取用户的评论通知
    topicsComment: domain + '/biz/user/',//用户所有主题待审核列表
    editorInfo: domain + '/biz/user/',//更新用户信息接口
    uploadImg: domain +'/biz/upload',//上传图片的接口
    address: domain +'/biz/search/address',//选择城市
    followMediaList: domain +'/biz/user/',//我的关注列表

    find: domain + '/biz/topics', // 发现 首页
    findNav: domain + '/biz/channels',//发现头部nav
    channel: domain + '/biz/topics/channel/',//频道下同主题列表
    myChannel: domain + '/biz/user/',//我选择得频道列表
    followtheme: domain + '/biz/topic/', //订阅主题 
    delFollow: domain + '/biz/topic/', // 取消订阅主题
    creatThemefrom: domain + '/biz/platforms', //发现 创建主题来源
    creatTheme: domain + '/biz/topics', // 发现 创建主题
    themeAvatar: domain + '/biz/topic_default_avatars',//创建主题得选择头像
    getvipcn: domain + '/biz/search/media', //查询公众号 创建主题中
    previewArticles: domain + '/wechat/consulting/theme/previewArticles', //创建主题 主题预览 
    history: domain + '/biz/user/', //发现页面 历史搜索记录
    clearnSearch: domain + '/biz/user/', //发现页面  清空历史搜索
    delSearchOne: domain + '/biz/user/',//搜素页面 删除单个
    searchfinish: domain + '/biz/search/', //发现页面 搜索    
    mediasChannel: domain + '/biz/medias/channel/',//频道下得媒体列表
    mediaFollow: domain + '/biz/media/',//关注媒体
    mediaEssays: domain + '/biz/media/',//媒体下面得文章列表
    mediaDetails: domain + '/biz/media/',//媒体详情
    media: domain + '/biz/platforms/',//专业媒体列表

}
// url加密
for (var key in api) {
    // console.log(key)
    var url = api[key]
    // console.log(url)
    function packageUri(url) {
        var util = require('../libs/md5.js');
        var _t = +new Date();
        var appK = "boot-do";
        url += '?' + '_t=' + _t + '&' + '_k=' + appK
        var secret = "boot-do";
        var _sign = ""; //_t _k加密后生成sign
        var temp = ""; //问号后面的参数
        // 截取问好后面的参数
        temp += url.split("?")[1];
        //字符串加密
        _sign += util.hexMD5(temp);
        // console.log(url)
        url = url.split("?")[0] + '?' + '_t=' + _t + '&' + '_k=' + appK + '&' + 'secret=' + secret + '&' + '_sign=' + _sign
        console.log(url)
    }
    // packageUri(url)
}
module.exports = {
    api,
    domain
};